import React from 'react'
// ===================================================================== Temp
import SearchForm from '#cpt/temp/SearchForm'
import Table from '#cpt/temp/Table'
// ===================================================================== global declare
const { $fn, $Lazy } = window
// ===================================================================== Lazy
const Page 				= $Lazy.load(()=>import('#tp/page/page-container'))
// ===================================================================== component
class Index extends React.Component{
	state = {
		data:[],
		pag: {},
		selectedKeys:[],
		// 搜索表单列表
		forms : [
			{ label: '创建时间',		names: ['start_date','end_date'],	type: 'date-range' },
		],
	}
	
	model = {}
	
	componentDidMount(){
		if(window.isInit){
			this.fetch()
		}
	}
	
	// paging
	fetch = () => $fn.fetch.call(this,'bs-salesman/lowerSalesman')
	
	// 表单
	cols = [
		{ title: '序号', 		dataIndex: 'id', 			...$fn.table.num },
		{ title: '员工编码', 	dataIndex: 'empl_name', 	width:200 },
		{ title: '创建时间', 	dataIndex: 'created_at', 	...$fn.table.time },
		{ title: '真实姓名', 	dataIndex: 'real_name', 	...$fn.table.name },
		{ title: '年龄', 		dataIndex: 'age', 			...$fn.table.age },
		{ title: '籍贯', 		dataIndex: 'address', 		width:100 },
		{ title: '最高学历', 	dataIndex: 'education', 	width:100 },
		{ title: '手机号', 		dataIndex: 'phone', 		...$fn.table.phone },
		{ title: '所属区域', 	dataIndex: 'region_name', 	width:150 },
		{ title: '在职状态', 	dataIndex: 'status', 		width:150, render:text => +text === 1 ? '在职' : '离职' },
	]
	
	render(){
		return (
			<>
				<Page title='我的下级业务员' >
					{/* 搜索 */}
					{ SearchForm.call(this) }
					{/* 表格 */}
					{ Table.call(this, { isInit: window.isInit }) }
				</Page>
			</>
		)
	}
}

export default Index